package cn.huijielong.modules.pub.entity;

import java.io.Serializable;
import java.util.Date;

import cn.huijielong.common.utils.Constant;
import cn.huijielong.common.utils.HttpContextUtils;


/**
 * 商户表
 * 
 * @author xys
 * @email xys@gmail.com
 * @date 2019-07-03 22:46:43
 */
public class MerchantEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//
	private Long merchantId;
	//
	private Long userId;
	//商户名
	private String name;
	//
	private int level;
	//
	private int userLimit;

	/**
	 * 设置：
	 */
	public void setMerchantId(Long merchantId) {
		this.merchantId = merchantId;
	}
	/**
	 * 获取：
	 */
	public Long getMerchantId() {
		return merchantId;
	}
	/**
	 * 设置：
	 */
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	/**
	 * 获取：
	 */
	public Long getUserId() {
		return userId;
	}
	/**
	 * 设置：商户名
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * 获取：商户名
	 */
	public String getName() {
		return name;
	}
	
	public int getLevel() {
		return level;
	}
	public void setLevel(int level) {
		this.level = level;
	}
	public int getUserLimit() {
		return userLimit;
	}
	public void setUserLimit(int userLimit) {
		this.userLimit = userLimit;
	}
	/**
	 * 从会话请求中获取商户Id
	 * @return
	 */
	public static Long getMerchantIdByRequest() {
		String merchantId=HttpContextUtils.getHeader(Constant.MERCHANT_ID);
		if(merchantId==null || merchantId.length()==0) {
			return null;
		}
		return Long.valueOf(merchantId);
	}
}
